package com.yswy.common.zfbOrder;

import com.alipay.api.response.AlipayUserAgreementQueryResponse;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

/**
 * @author 19401
 * @date 2022/5/31 15:56
 **/
@Data
public class CallbackAgreementResVO {
    private String charset ;
    private String notify_time;
    //用户的支付宝账号对应的支付宝唯一用户号。
    private String alipay_user_id;
    private String sign;
    //扣协议中标示用户的唯一签约号，商家自定义。仅签约接口传入时返回。
    private String external_agreement_no;
    private String version;
    private String sign_time;
    private String notify_id;
    //异步通知类型，枚举支持。dut_user_sign：当 status = NORMAL 表示签约成功。dut_user_unsign：当 status = UNSIGN 表示解约成功。
    private String notify_type;
    //支付宝系统中用以唯一标识用户签约记录的编号。
    private String agreement_no;
    private String invalid_time;
    private String auth_app_id;
    //协议产品码。
    private String personal_product_code;
    private String valid_time;
    private String login_token;
    private String app_id;
    private String sign_type;
    //签约协议场景。
    private String sign_scene;
    //NORMAL：正常。 UNSIGN：解约。
    private String status;
    //用户的支付宝登录账号。
    private String alipay_logon_id;

    public CallbackAgreementResVO(Map<String, String> parameters) {
        this.charset = parameters.get("charset");
        this.notify_time = parameters.get("notify_time");
        this.alipay_user_id = parameters.get("alipay_user_id");
        this.sign = parameters.get("sign");
        this.external_agreement_no = parameters.get("external_agreement_no");
        this.version = parameters.get("version");
        this.sign_time = parameters.get("sign_time");
        this.notify_id = parameters.get("notify_id");
        this.notify_type = parameters.get("notify_type");
        this.agreement_no = parameters.get("agreement_no");
        this.invalid_time = parameters.get("invalid_time");
        this.auth_app_id = parameters.get("auth_app_id");
        this.personal_product_code = parameters.get("personal_product_code");
        this.valid_time = parameters.get("valid_time");
        this.login_token = parameters.get("login_token");
        this.app_id = parameters.get("app_id");
        this.sign_type = parameters.get("sign_type");
        this.sign_scene = parameters.get("sign_scene");
        this.status = parameters.get("status");
        this.alipay_logon_id = parameters.get("alipay_logon_id");
    }
    public CallbackAgreementResVO( AlipayUserAgreementQueryResponse response) {

        this.notify_time = response.getSignTime();
        this.alipay_user_id = response.getAlipayLogonId();
        this.external_agreement_no = response.getExternalAgreementNo();
        this.sign_time = response.getSignTime();
        this.agreement_no = response.getAgreementNo();
        this.invalid_time = response.getInvalidTime();
        this.personal_product_code = response.getPersonalProductCode();
        this.valid_time = response.getValidTime();
        this.sign_type = response.getSignTime();
        this.sign_scene = response.getSignScene();
        this.status = response.getStatus();
        this.alipay_logon_id = response.getAlipayLogonId();
    }

}
